﻿doctrine_monogamy = {
	doctrine_group_type = doctrine_marriage_type
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_monogamy }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}
	parameters = {
		doctrine_monogamy
		marriage_event
	}
	special_parameters = {
		number_of_spouses = 1
	}
}

doctrine_polygamy = {
	doctrine_group_type = doctrine_marriage_type
	index = 1
	divergence = 30

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_polygamy }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}
	parameters = {
		doctrine_polygamy
		spouse_piety_loss
	}

	special_parameters = {
		number_of_spouses = 4
	}
}

doctrine_concubines = {
	doctrine_group_type = doctrine_marriage_type
	index = 2
	divergence = 20

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_concubines }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}
	parameters = {
		doctrine_concubines
	}

	special_parameters = {
		number_of_spouses = 1
		number_of_consorts = 3
	}
}

doctrine_divorce_disallowed = {
	doctrine_group_type = doctrine_divorce
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_divorce_disallowed }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_divorce_allowed }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}

	}
	parameters = {
		divorce_disallowed
	}
}

doctrine_divorce_approval = {
	doctrine_group_type = doctrine_divorce
	index = 1
	divergence = 5

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_divorce_approval }
			multiply = faith_unchanged_doctrine_cost_mult
		}

	}
	parameters = {
		divorce_approval
	}
}

doctrine_divorce_allowed = {
	doctrine_group_type = doctrine_divorce
	index = 2
	divergence = 15

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_divorce_allowed }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_divorce_disallowed }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}
	parameters = {
		divorce_allowed
	}
}

doctrine_bastardry_none = {
	doctrine_group_type = doctrine_bastardry
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_bastardry_none }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_bastardry_all }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}
	parameters = {
		bastards_none
	}
}

doctrine_bastardry_legitimization = {
	doctrine_group_type = doctrine_bastardry
	index = 1
	divergence = 5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_bastardry_legitimization }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		bastards_legitimize
	}
}

doctrine_bastardry_all = {
	doctrine_group_type = doctrine_bastardry
	index = 2
	divergence = 10

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_bastardry_all }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_bastardry_none }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		bastards_always
	}
}

doctrine_homosexuality_crime = {
	doctrine_group_type = doctrine_homosexuality
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_homosexuality_crime }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_homosexuality_accepted }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		homosexuality_illegal
	}

	traits = {
		sins = {
			sodomite = { weight = 60 scale = 2 }
		}
	}

}

doctrine_homosexuality_shunned = {
	doctrine_group_type = doctrine_homosexuality
	index = 1
	divergence = 5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_homosexuality_shunned }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		homosexuality_shunned
	}
}

doctrine_homosexuality_accepted = {
	doctrine_group_type = doctrine_homosexuality
	index = 2
	divergence = 15

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_homosexuality_accepted }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_homosexuality_crime }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		homosexuality_accepted
	}
}

doctrine_deviancy_crime = {
	doctrine_group_type = doctrine_deviancy
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_deviancy_crime }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_deviancy_accepted }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_deviancy_virtuous }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
	}

	parameters = {
		deviancy_illegal
	}

	traits = {
		sins = {
			deviant = { weight = 80 scale = 2 }
		}
	}

}

doctrine_deviancy_shunned = {
	doctrine_group_type = doctrine_deviancy
	index = 1
	divergence = 5

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_deviancy_shunned }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_deviancy_virtuous }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		deviancy_shunned
	}
}

doctrine_deviancy_accepted = {
	doctrine_group_type = doctrine_deviancy
	index = 2
	divergence = 15

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_deviancy_accepted }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_deviancy_crime }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		deviancy_accepted
	}
}

doctrine_deviancy_virtuous = {
	doctrine_group_type = doctrine_deviancy
	index = 3
	divergence = 20

	can_pick = {
		trigger_if = {
			limit = { NOT = { has_doctrine = doctrine_deviancy_virtuous } }
			custom_description = {
				text = must_select_carnal_exaltation
				tenet:tenet_carnal_exaltation = { is_in_list = selected_doctrines }
			}
		}
	}

	piety_cost = {
		value = faith_doctrine_cost_massive
		if = {
			limit = { rite_has_doctrine = doctrine_deviancy_virtuous }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_deviancy_shunned }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_deviancy_crime }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
	}

	traits = {
		virtues = {
			deviant = { weight = 100 scale = 2 }
		}
	}

	parameters = {
		deviancy_accepted
	}
}

doctrine_adultery_men_crime = {
	doctrine_group_type = doctrine_adultery_men
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_adultery_men_crime }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_adultery_men_accepted }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}
	parameters = {
		adultery_male_crime
	}
}

doctrine_adultery_men_shunned = {
	doctrine_group_type = doctrine_adultery_men
	index = 1
	divergence = 5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_adultery_men_shunned }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}
	parameters = {
		adultery_male_shunned
	}
}

doctrine_adultery_men_accepted = {
	doctrine_group_type = doctrine_adultery_men
	index = 2
	divergence = 10

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_adultery_men_accepted }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_adultery_men_crime }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}
	parameters = {
		adultery_male_accepted
	}
}

doctrine_adultery_women_crime = {
	doctrine_group_type = doctrine_adultery_women
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_adultery_women_crime }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_adultery_women_accepted }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		adultery_female_crime
	}
}

doctrine_adultery_women_shunned = {
	doctrine_group_type = doctrine_adultery_women
	index = 1
	divergence = 5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_adultery_women_shunned }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		adultery_female_shunned
	}
}

doctrine_adultery_women_accepted = {
	doctrine_group_type = doctrine_adultery_women
	index = 2
	divergence = 10

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_adultery_women_accepted }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_adultery_women_crime }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		adultery_female_accepted
	}
}

doctrine_kinslaying_any_dynasty_member_crime = {
	doctrine_group_type = doctrine_kinslaying
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_any_dynasty_member_crime }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_close_kin_crime }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_shunned }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_accepted }
			multiply = faith_changed_doctrine_cost_mult_four_step
		}
	}

	parameters = {
		kinslaying_any_dynasty_member_crime
	}

	traits = {
		sins = {
			kinslayer_1 = { weight = 50 scale = 2 }
		}
	}
}

doctrine_kinslaying_extended_family_crime = {
	doctrine_group_type = doctrine_kinslaying
	index = 1
	divergence = 2.5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_extended_family_crime }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_shunned }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_accepted }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
	}

	parameters = {
		kinslaying_extended_family_crime
	}

	traits = {
		sins = {
			kinslayer_2 = { weight = 50 scale = 2 }
		}
	}
}

doctrine_kinslaying_close_kin_crime = {
	doctrine_group_type = doctrine_kinslaying
	index = 2
	divergence = 5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_close_kin_crime }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = {
				OR = {
					rite_has_doctrine = doctrine_kinslaying_accepted
					rite_has_doctrine = doctrine_kinslaying_any_dynasty_member_crime
				}
			}
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		kinslaying_close_kin_crime
	}

	traits = {
		sins = {
			kinslayer_3 = { weight = 50 scale = 2 }
		}
	}
}

doctrine_kinslaying_shunned = {
	doctrine_group_type = doctrine_kinslaying
	index = 3
	divergence = 7.5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_shunned }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_extended_family_crime }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_any_dynasty_member_crime }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
	}

	parameters = {
		kinslaying_shunned
	}
}

doctrine_kinslaying_accepted = {
	doctrine_group_type = doctrine_kinslaying
	index = 4
	divergence = 10

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_accepted }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_close_kin_crime }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_extended_family_crime }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_kinslaying_any_dynasty_member_crime }
			multiply = faith_changed_doctrine_cost_mult_four_step
		}

	}

	parameters = {
		kinslaying_accepted
	}
}

doctrine_witchcraft_crime = {
	doctrine_group_type = doctrine_witchcraft
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_witchcraft_crime }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_witchcraft_accepted }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_witchcraft_virtuous }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
	}

	parameters = {
		witchcraft_illegal
	}

	traits = {
		sins = {
			witch = { weight = 80 scale = 2 }
		}
	}
}

doctrine_witchcraft_shunned = {
	doctrine_group_type = doctrine_witchcraft
	index = 1
	divergence = 5

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_witchcraft_shunned }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_witchcraft_virtuous }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		witchcraft_shunned
	}
}

doctrine_witchcraft_accepted = {
	doctrine_group_type = doctrine_witchcraft
	index = 2
	divergence = 15

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_witchcraft_accepted }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_witchcraft_crime }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		witchcraft_accepted
	}
}

doctrine_witchcraft_virtuous = {
	doctrine_group_type = doctrine_witchcraft
	index = 3
	divergence = 20

	piety_cost = {
		value = faith_tenet_cost_massive
		if = {
			limit = { rite_has_doctrine = doctrine_witchcraft_virtuous }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_witchcraft_shunned }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_witchcraft_crime }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
	}

	traits = {
		virtues = {
			witch = { weight = 100 scale = 2 }
		}
	}

	parameters = {
		witchcraft_accepted
	}
}

doctrine_gender_male_dominated = {
	doctrine_group_type = doctrine_gender
	index = 0
	divergence = 0

	icon = "doctrine_gender_male_dominated"

	is_shown = {
		NOT = { has_game_rule = full_gender_equality }
	}

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_gender_male_dominated }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_gender_female_dominated }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		male_dominated_law
		female_claims_are_weak
		women_cannot_inherit_implicit_claims
		women_cannot_be_granted_titles
		male_dominated_council
		combatant_must_be_male_if_no_roco
	}

	character_modifier = {
		name = female_ruler_male_dominant
		opinion_of_female_rulers = -10
	}

	can_pick = {
		NAND = {
			exists = religious_head
			religious_head.culture = { has_cultural_parameter = female_only_inheritance }
		}
	}
}

doctrine_gender_equal = {
	doctrine_group_type = doctrine_gender
	index = 1
	divergence = 20

	icon = "doctrine_gender_equal"

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_gender_equal }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		gender_equal_law
		combatant_can_be_either_gender_if_no_roco
	}
}

doctrine_gender_female_dominated = {
	doctrine_group_type = doctrine_gender
	index = 2
	divergence = 40

	icon = "doctrine_gender_female_dominated"

	is_shown = {
		NOT = { has_game_rule = full_gender_equality }
	}

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_gender_female_dominated }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_gender_male_dominated }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		female_dominated_law
		male_claims_are_weak
		men_cannot_inherit_implicit_claims
		men_cannot_be_granted_titles
		female_dominated_council
		combatant_must_be_female_if_no_roco
	}

	character_modifier = {
		name = male_ruler_female_dominant
		opinion_of_male_rulers = -10
	}

	can_pick = {
		NAND = {
			exists = religious_head
			religious_head.culture = { has_cultural_parameter = male_only_inheritance }
		}
	}
}

doctrine_consanguinity_dynastic = {
	doctrine_group_type = doctrine_consanguinity
	index = 0
	divergence = 0
	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_restricted }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_aunt_nephew_and_uncle_niece }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_unrestricted }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
	}

	parameters = {
		consanguinity_restricted_dynastic_marriage
		consanguinity_restricted_marriage
		consanguinity_restricted_close_kin_incest
	}
}

doctrine_consanguinity_restricted = {
	doctrine_group_type = doctrine_consanguinity
	index = 1
	divergence = 1.5

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_restricted }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_aunt_nephew_and_uncle_niece }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_unrestricted }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
	}

	parameters = {
		consanguinity_restricted_marriage
		consanguinity_restricted_close_kin_incest
	}
}

doctrine_consanguinity_cousins = {
	doctrine_group_type = doctrine_consanguinity
	index = 2
	divergence = 3

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_cousins }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_unrestricted }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		consanguinity_cousins_marriage
		consanguinity_cousins_incest
		allows_cousin_marriage
	}
}

doctrine_consanguinity_aunt_nephew_and_uncle_niece = {
	doctrine_group_type = doctrine_consanguinity
	index = 3
	divergence = 5

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_aunt_nephew_and_uncle_niece }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_restricted }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		consanguinity_aunt_nephew_and_uncle_niece_marriage
		consanguinity_aunt_nephew_and_uncle_niece_incest
		allows_cousin_marriage
		allows_aunt_nephew_and_uncle_niece_marriage
	}
}

doctrine_consanguinity_unrestricted = {
	doctrine_group_type = doctrine_consanguinity
	index = 4
	divergence = 40

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_unrestricted }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_cousins }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_consanguinity_restricted }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
	}

	parameters = {
		consanguinity_unrestricted_marriage
		consanguinity_unrestricted_incest
		allows_cousin_marriage
		allows_aunt_nephew_and_uncle_niece_marriage
		allows_unrestricted_marriage
	}
}

doctrine_pluralism_fundamentalist = {
	doctrine_group_type = doctrine_pluralism
	index = 0
	divergence = 0

	icon = "doctrine_pluralism_fundamentalist"

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_pluralism_fundamentalist }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_pluralism_pluralistic }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		pluralism_fundamentalist_proselytization_bonus
		pluralism_fundamentalist_faction_join_chance
		pluralism_fundamentalist_vulnerable_to_heresy
		pluralism_fundamentalist_revocation_tyranny_minimal
	}

	special_parameters = {
		hostility_towards_us_mult = 2
		heresy_threshold = -5
	}

	character_modifier = {
		minority_different_faith_opinion = -20
	}
}

doctrine_pluralism_righteous = {
	doctrine_group_type = doctrine_pluralism
	index = 1
	divergence = 5

	icon = "doctrine_pluralism_righteous"

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_pluralism_righteous }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		pluralism_righteous_revocation_tyranny_reduced
	}

	special_parameters = {
		hostility_towards_us_mult = 1
	}

	character_modifier = {
		minority_different_faith_opinion = -10
	}
}

doctrine_pluralism_pluralistic = {
	doctrine_group_type = doctrine_pluralism
	index = 2
	divergence = 10

	icon = "doctrine_pluralism_pluralistic"

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_pluralism_pluralistic }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_pluralism_fundamentalist }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	can_pick = {
		custom_description = {
			text = incompatible_tenet_pentarchy_trigger
			NOT = { tenet:tenet_pentarchy = { is_in_list = selected_doctrines } }
		}
	}

	parameters = {
		pluralism_pluralistic_proselytization_penalty
		pluralism_pluralistic_faction_join_chance
		pluralism_pluralistic_resistant_to_heresy
		pluralism_pluralistic_holy_wars_preserve_vassals
	}

	special_parameters = {
		hostility_towards_us_mult = 0.5
		heresy_threshold = 5
	}
}

doctrine_theocracy_temporal = {
	doctrine_group_type = doctrine_theocracy
	index = 0
	divergence = 0

	icon = "doctrine_theocracy_temporal"

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_theocracy_temporal }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_theocracy_lay_clergy }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	can_pick = {
		custom_description = {
			text = incompatible_doctrine_theocracy_temporal_trigger
			NOT = { doctrine:doctrine_temporal_head = { is_in_list = selected_doctrines } }
		}
	}

	parameters = {
		theocracy_temple_lease
	}
}

doctrine_theocracy_lay_clergy = {
	doctrine_group_type = doctrine_theocracy
	index = 1
	divergence = 20

	icon = "doctrine_theocracy_lay_clergy"

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_theocracy_lay_clergy }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_theocracy_temporal }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		theocracy_temple_ownership
		lay_clergy
	}

	special_parameters = {
		allowed_holding_types = { church_holding }
	}
}

doctrine_no_head = {
	doctrine_group_type = doctrine_head_of_faith
	index = 0
	divergence = 10

	icon = "doctrine_no_head"

	visible = no

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_no_head }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		no_head_of_faith
	}
	special_parameters = {
		bonus_fervor_gain = 0.5
		# We protect against this because one main rite swap can turn several rites heretical at once
		bonus_heresy_protection = 1
		# We sit this above heresy outbreak and below rite-conversion balance so both still happen
		minimum_fervor = 45
		heresy_threshold = 5
	}
}

doctrine_spiritual_head = {
	doctrine_group_type = doctrine_head_of_faith
	index = 1
	divergence = 30

	icon = "doctrine_spiritual_head"

	visible = no

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_spiritual_head }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		spiritual_head_of_faith
		spiritual_head_of_faith_claims
		spiritual_head_of_faith_gold
	}
}

doctrine_temporal_head = {
	doctrine_group_type = doctrine_head_of_faith
	index = 2
	divergence = 10

	icon = "doctrine_temporal_head"

	visible = no

	piety_cost = {
		value = faith_doctrine_cost_massive
		if = {
			limit = { rite_has_doctrine = doctrine_temporal_head }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	can_pick = {
		custom_description = {
			text = incompatible_doctrine_theocracy_temporal_trigger
			NOT = { doctrine:doctrine_theocracy_temporal = { is_in_list = selected_doctrines } }
		}
		custom_description = {
			text = incompatible_doctrine_spiritual_appointment_temporal_trigger
			NOR = {
				doctrine:doctrine_clerical_succession_spiritual_appointment = { is_in_list = selected_doctrines }
				doctrine:doctrine_clerical_succession_spiritual_fixed_appointment = { is_in_list = selected_doctrines }
			}
		}
	}

	parameters = {
		temporal_head_of_faith
		temporal_head_of_faith_directed_holy_wars
	}
}

doctrine_clerical_function_taxation = {
	doctrine_group_type = doctrine_clerical_function
	index = 0
	divergence = 1.5

	clergy_modifier = {
		#monthly_county_control_growth_add_even_if_baron = 0.2
		monthly_county_control_growth_factor_even_if_baron = 0.2
	}

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_function_taxation }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}
}

doctrine_clerical_function_alms_and_pacification = {
	doctrine_group_type = doctrine_clerical_function
	index = 1
	divergence = 1.5

	clergy_modifier = {
		county_opinion_add_even_if_baron = 10
		domain_tax_mult_even_if_baron = -0.05
	}

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_function_alms_and_pacification }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}
}

doctrine_clerical_function_recruitment = {
	doctrine_group_type = doctrine_clerical_function
	index = 2
	divergence = 2.5

	clergy_modifier = {
		domain_tax_same_faith_mult_even_if_baron = -0.03
		levy_reinforcement_rate_same_faith_even_if_baron = 0.3
		prowess = 4
	}

	parameters = {
		clergy_can_fight
	}

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_function_recruitment }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}
}

doctrine_clerical_gender_male_only = {
	doctrine_group_type = doctrine_clerical_gender
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_gender_male_only }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_clerical_gender_female_only }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		clergy_must_be_male
	}
}

doctrine_clerical_gender_female_only = {
	doctrine_group_type = doctrine_clerical_gender
	index = 2
	divergence = 20

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_gender_female_only }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_clerical_gender_male_only }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		clergy_must_be_female
	}
}

doctrine_clerical_gender_either = {
	doctrine_group_type = doctrine_clerical_gender
	index = 1
	divergence = 10

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_gender_either }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		clergy_can_be_either_gender
	}
}

doctrine_clerical_marriage_allowed = {
	doctrine_group_type = doctrine_clerical_marriage
	index = 0
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_marriage_allowed }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_clerical_marriage_disallowed }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	# not defining the parameter means it is false by default
	parameters = {
		clergy_can_marry
	}
}

doctrine_clerical_marriage_disallowed = {
	doctrine_group_type = doctrine_clerical_marriage
	index = 1
	divergence = 15

	parameters = {
		clergy_can_marry_disabled
	}

	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_marriage_disallowed }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_clerical_marriage_allowed }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}
}

doctrine_clerical_succession_temporal_appointment = { # Temporal, Free
	doctrine_group_type = doctrine_clerical_succession
	index = 0
	divergence = 10

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_succession_temporal_appointment }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else = {
			if = {
				limit = {
					OR = { # Was Spiritual
						rite_has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment
						rite_has_doctrine = doctrine_clerical_succession_spiritual_appointment
					}
				}
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			if = {
				limit = {
					OR = {	# Was Fixed
						rite_has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment
						rite_has_doctrine = doctrine_clerical_succession_temporal_fixed_appointment
					}
				}
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		# Round up to the nearest multiple of 25
		divide = 25
		ceiling = yes
		multiply = 25
	}

	parameters = {
		clerical_appointment_ruler
		clerical_appointment_fixed_disabled
		clerical_appointment_ruler_can_replace_ecc
	}
}

doctrine_clerical_succession_spiritual_appointment = { # Spiritual, Free
	doctrine_group_type = doctrine_clerical_succession
	index = 1
	divergence = 10

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_succession_spiritual_appointment }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else = {
			if = {
				limit = {
					OR = { # Was Temporal
						rite_has_doctrine = doctrine_clerical_succession_temporal_fixed_appointment
						rite_has_doctrine = doctrine_clerical_succession_temporal_appointment
					}
				}
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			if = {
				limit = {
					OR = {	# Was Fixed
						rite_has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment
						rite_has_doctrine = doctrine_clerical_succession_temporal_fixed_appointment
					}
				}
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		# Round up to the nearest multiple of 25
		divide = 25
		ceiling = yes
		multiply = 25
	}

	can_pick = {
		custom_description = {
			text = incompatible_doctrine_spiritual_appointment_temporal_trigger
			NOT = { doctrine:doctrine_temporal_head = { is_in_list = selected_doctrines } }
		}
	}

	parameters = {
		clerical_appointment_head_of_faith
		clerical_appointment_fixed_disabled
		clerical_appointment_hof_can_replace_ecc
	}
}

doctrine_clerical_succession_temporal_fixed_appointment = { # Temporal, Fixed
	doctrine_group_type = doctrine_clerical_succession
	index = 2
	divergence = 10

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_succession_temporal_fixed_appointment }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else = {
			if = {
				limit = {
					OR = { # Was Spiritual
						rite_has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment
						rite_has_doctrine = doctrine_clerical_succession_spiritual_appointment
					}
				}
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			if = {
				limit = {
					OR = {	# Was free
						rite_has_doctrine = doctrine_clerical_succession_spiritual_appointment
						rite_has_doctrine = doctrine_clerical_succession_temporal_appointment
					}
				}
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		# Round up to the nearest multiple of 25
		divide = 25
		ceiling = yes
		multiply = 25
	}

	parameters = {
		clerical_appointment_ruler
		clerical_appointment_fixed
	}
}

doctrine_clerical_succession_spiritual_fixed_appointment = { # Spiritual, Fixed
	doctrine_group_type = doctrine_clerical_succession
	index = 3
	divergence = 10

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else = {
			if = {
				limit = {
					OR = { # Was Temporal
						rite_has_doctrine = doctrine_clerical_succession_temporal_fixed_appointment
						rite_has_doctrine = doctrine_clerical_succession_temporal_appointment
					}
				}
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			if = {
				limit = {
					OR = {	# Was Free
						rite_has_doctrine = doctrine_clerical_succession_spiritual_appointment
						rite_has_doctrine = doctrine_clerical_succession_temporal_appointment
					}
				}
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		# Round up to the nearest multiple of 25
		divide = 25
		ceiling = yes
		multiply = 25
	}

	can_pick = {
		custom_description = {
			text = incompatible_doctrine_spiritual_appointment_temporal_trigger
			NOT = { doctrine:doctrine_temporal_head = { is_in_list = selected_doctrines } }
		}
	}

	parameters = {
		clerical_appointment_head_of_faith
		clerical_appointment_fixed
	}
}

doctrine_clerical_succession_conditional = { # Conditional (CE3) - contested appointment; both seculars and clergy may replace ecclesiastical titles, driving the Investiture Crisis
	doctrine_group_type = doctrine_clerical_succession
	index = 4
	# Kept at 0 so the rites we set to this at game start do not drift into heresy on their own
	divergence = 0

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_clerical_succession_conditional }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		# Round up to the nearest multiple of 25
		divide = 25
		ceiling = yes
		multiply = 25
	}

	# Reform never picks this, so it only comes from ecumenical councils or the game start
	can_pick = {
		custom_tooltip = {
			text = doctrine_clerical_succession_conditional_can_pick_tt
			scope:actor.rite = { rite_has_doctrine = doctrine_clerical_succession_conditional }
		}
	}

	parameters = {
		clerical_appointment_ruler
		clerical_appointment_fixed_disabled
		clerical_appointment_ruler_can_replace_ecc
		clerical_appointment_hof_can_replace_ecc
	}
}

doctrine_pilgrimage_forbidden = {
	doctrine_group_type = doctrine_pilgrimage
	index = 0
	divergence = 0

	icon = "doctrine_pilgrimage_forbidden"

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_pilgrimage_forbidden }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	character_modifier = {
		monthly_piety_gain_mult = 0.2
		advantage_against_coreligionists = 5
	}

	parameters = {
		forbidden_from_pilgrimage
	}

	traits = {
		sins = {
			pilgrim = { weight = 100 scale = 2 }
		}
	}
}

doctrine_pilgrimage_encouraged = {
	doctrine_group_type = doctrine_pilgrimage
	index = 1
	divergence = 5

	icon = "doctrine_pilgrimage_encouraged"

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_pilgrimage_encouraged }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		can_go_on_pilgrimage
		basic_pilgrimage_rewards
	}

	traits = {
		virtues = {
			pilgrim = { weight = 30 scale = 2 }
		}
	}
}

doctrine_pilgrimage_local_rites = {
	doctrine_group_type = doctrine_pilgrimage
	index = 2
	divergence = 2.5
	
	icon = "doctrine_pilgrimage_local_rites"

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_pilgrimage_local_rites }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		local_shrine_offering
		can_go_on_pilgrimage
		basic_pilgrimage_rewards
	}
}

doctrine_pilgrimage_mandatory = {
	doctrine_group_type = doctrine_pilgrimage
	index = 3
	divergence = 7.5

	icon = "doctrine_pilgrimage_mandatory"

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_pilgrimage_mandatory }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	is_shown = {
		NOT = { religion_tag = islam_religion }
	}

	character_modifier = {
		monthly_piety_gain_mult = -0.25
		same_faith_opinion = -5
	}

	parameters = {
		can_go_on_pilgrimage
		mandatory_pilgrimage
		basic_pilgrimage_rewards
	}
}

doctrine_pilgrimage_mandatory_hajj = {
	doctrine_group_type = doctrine_pilgrimage
	index = 4
	divergence = 10

	icon = "doctrine_pilgrimage_mandatory_hajj"

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_pilgrimage_mandatory_hajj }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	is_shown = {
		religion_tag = islam_religion
	}

	character_modifier = {
		monthly_piety_gain_mult = -0.25
		same_faith_opinion = -5
	}

	parameters = {
		can_go_on_pilgrimage
		mandatory_hajj
		basic_pilgrimage_rewards
	}
}

doctrine_funeral_stoic = { # Abrahamic funerals, stand around and try not to cry too much before the body is humbly buried
	doctrine_group_type = doctrine_funeral
	index = 0
	divergence = 1.5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_funeral_stoic }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		burial_funeral
		stoic_funeral
	}
}

doctrine_funeral_bewailment = { # West African funerals, strongly encouraged to show emotion before the body is humbly buried
	doctrine_group_type = doctrine_funeral
	index = 1
	divergence = 1.5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_funeral_bewailment }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		burial_funeral
		bewailment_funeral
	}
}

doctrine_funeral_cremation = { # Catch-all cremations, burn or otherwise dissolve the body
	doctrine_group_type = doctrine_funeral
	index = 2
	divergence = 2.5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_funeral_cremation }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		cremation_funeral
	}
}

doctrine_funeral_sky_burial = { # Have the body fed to scavenging animals and birds
	doctrine_group_type = doctrine_funeral
	index = 3
	divergence = 5

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_funeral_sky_burial }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		sky_burials_active
		sky_burials_charnel_grounds
		can_build_towers_of_silence_active
	}

	character_modifier = {
		negate_health_penalty_add = 0.25
	}
}

doctrine_funeral_mummification = { # Fanatically preserve the body, very expensive
	doctrine_group_type = doctrine_funeral
	index = 4
	divergence = 15

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_funeral_mummification }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		mummification_funeral
	}

	can_pick = {
		custom_description = {
			text = incompatible_tenet_aniconism_trigger
			NOT = { tenet:tenet_aniconism = { is_in_list = selected_doctrines } }
		}
	}
}

doctrine_family_rites = { # Solemn veneration
	doctrine_group_type = doctrine_funeral
	index = 5
	divergence = 2.5
	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = doctrine_family_rites }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		if = {
			limit = { rite_has_tenet = tenet_filial_piety }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	parameters = {
		burial_funeral
		family_rites
	}

	can_pick = {
		trigger_if = {
			limit = { scope:actor ?= { is_ai = yes } }
			scope:actor = { government_has_flag = government_uses_meritocratic_bureaucracy }
		}
	}
}

doctrine_no_anointment = {
	doctrine_group_type = doctrine_coronation
	index = 0
	piety_cost = {
		value = faith_doctrine_cost_mid
	}

	parameters = {
		no_anointment = yes
		coronation_artifact = yes
	}
}

doctrine_anointment_permitted = {
	doctrine_group_type = doctrine_coronation
	index = 1
	piety_cost = {
		value = faith_doctrine_cost_mid
	}

	parameters = {
		theocratic_coronation = yes
		coronation_artifact = yes
	}

	can_pick = {
		custom_description = {
			text = doctrine_requires_theocratic_head_of_faith_trigger
			NOR = {
				doctrine:doctrine_no_head = { is_in_list = selected_doctrines }
				doctrine:doctrine_temporal_head = { is_in_list = selected_doctrines }
			}
		}
	}
}

doctrine_imperial_anointment = {
	doctrine_group_type = doctrine_coronation
	index = 2
	piety_cost = {
		value = faith_doctrine_cost_mid
	}

	parameters = {
		imperial_anointment = yes
		coronation_artifact = yes
	}

	can_pick = {
		custom_description = {
			text = doctrine_requires_theocratic_head_of_faith_trigger
			NOR = {
				doctrine:doctrine_no_head = { is_in_list = selected_doctrines }
				doctrine:doctrine_temporal_head = { is_in_list = selected_doctrines }
			}
		}
	}
}

doctrine_monotheist = {
	doctrine_group_type = doctrine_theism
	index = 0
	divergence = 75
	
	icon = "doctrine_monotheist"

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = {
				OR = {
					rite_has_doctrine = abrahamic_hostility_doctrine
					rite_has_doctrine = doctrine_monotheist
				}
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	special_parameters = {
		hostility_levels = {
			unrelated = evil
		}
	}
}

doctrine_polytheist = {
	doctrine_group_type = doctrine_theism
	index = 1
	divergence = 75
	
	icon = "doctrine_polytheist"

	piety_cost = {
		value = faith_doctrine_cost_high
		if = {
			limit = { rite_has_doctrine = abrahamic_hostility_doctrine }
			multiply = faith_changed_doctrine_cost_mult_three_step
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_polytheist }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}

	special_parameters = {
		hostility_levels = {
			unrelated = hostile
		}
	}
}

doctrine_scriptural = {
	doctrine_group_type = preservation
	index = 0
	icon = "doctrine_scriptural"

	parameters = {
		faith_coherence_high
	}
}

doctrine_mythic_literary = {
	doctrine_group_type = preservation
	index = 1
	icon = "doctrine_mythic_literary"

	parameters = {
		faith_coherence_normal
	}
}

doctrine_oral_storytelling = {
	doctrine_group_type = preservation
	index = 2
	icon = "doctrine_oral_storytelling"

	parameters = {
		can_only_be_learned_in_person
		faith_coherence_low
	}
}

doctrine_monasticism_encouraged = {
	doctrine_group_type = monasticism_group
	index = 0
	divergence = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					religion_tag = christianity_religion
					main_rite = { pam_latin_as_liturgical_language_trigger = yes }
				}
				desc = doctrine_christianity_monasticism_latin_desc
			}
			triggered_desc = {
				trigger = {
					religion_tag = christianity_religion
					main_rite = { pam_greek_as_liturgical_language_trigger = yes }
				}
				desc = doctrine_christianity_monasticism_greek_desc
			}
			triggered_desc = {
				trigger = {
					religion_tag = christianity_religion
					main_rite = {
						pam_latin_as_liturgical_language_trigger = no
						pam_greek_as_liturgical_language_trigger = no
					}
				}
				desc = doctrine_christianity_monasticism_default_desc
			}
			desc = doctrine_monasticism_encouraged_desc
		}
	}

	piety_cost = {
		if = {
			limit = {
				OR = {
					rite_religion_tag = christianity_religion
					rite_religion_tag = dualism_religion
					rite_religion_tag = buddhism_religion
					rite_religion_tag = jainism_religion
				}
			}
			value = faith_tenet_cost_low
		}
		else_if = {
			limit = {
				OR = {
					rite_religion_tag = zoroastrianism_religion
					rite_has_doctrine = pagan_hostility_doctrine
				}
			}
			value = faith_tenet_cost_high
		}
		else = {
			value = faith_tenet_cost_mid
		}

		if = {
			limit = { rite_has_doctrine = doctrine_monasticism_encouraged }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = {
				OR = {
					rite_has_doctrine = doctrine_monasticism_accepted
					rite_has_doctrine = doctrine_monasticism_absent
					rite_has_doctrine = doctrine_monasticism_forbidden
				}
			}
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		take_vows_active
	}

	can_pick = {
		custom_description = {
			text = incompatible_tenet_hedonistic_trigger
			NOT = { tenet:tenet_hedonistic = { is_in_list = selected_doctrines } }
		}
	}

	clergy_modifier = {
		county_opinion_add_even_if_baron = 5
	}

	traits = {
		virtues = {
			temperate = { weight = 20 scale = 1 }
			devoted = { weight = 30 scale = 1 }
		}
		sins = {
			gluttonous = { weight = 10 scale = 1 }
		}
	}
}

doctrine_monasticism_accepted = {
	doctrine_group_type = monasticism_group
	index = 1
	divergence = 1

	desc = doctrine_monasticism_accepted_desc

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_monasticism_accepted }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = {
				OR = {
					rite_has_doctrine = doctrine_monasticism_absent
					rite_has_doctrine = doctrine_monasticism_forbidden
				}
			}
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		take_vows_active
	}

	can_pick = {
		custom_description = {
			text = incompatible_tenet_hedonistic_trigger
			NOT = { tenet:tenet_hedonistic = { is_in_list = selected_doctrines } }
		}
	}

	clergy_modifier = {
		county_opinion_add_even_if_baron = 3
	}

	traits = {
		virtues = {
			temperate = { weight = 10 scale = 1 }
		}
		sins = {
			gluttonous = { weight = 5 scale = 1 }
		}
	}
}

doctrine_monasticism_absent = {
	doctrine_group_type = monasticism_group
	index = 2
	divergence = 3

	desc = doctrine_monasticism_absent_desc

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_monasticism_absent }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = {
				OR = {
					rite_has_doctrine = doctrine_monasticism_encouraged
					rite_has_doctrine = doctrine_monasticism_accepted
					rite_has_doctrine = doctrine_monasticism_forbidden
				}
			}
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	can_pick = {
		custom_description = {
			text = incompatible_tenet_anachoresis_trigger
			NOT = { tenet:tenet_anachoresis = { is_in_list = selected_doctrines } }
		}
	}
}

doctrine_monasticism_forbidden = {
	doctrine_group_type = monasticism_group
	index = 3
	divergence = 5

	desc = doctrine_monasticism_forbidden_desc

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_monasticism_forbidden }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = {
				OR = {
					rite_has_doctrine = doctrine_monasticism_encouraged
					rite_has_doctrine = doctrine_monasticism_accepted
				}
			}
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	parameters = {
		devoted_trait_criminal
		cannot_take_the_vows
	}

	can_pick = {
		custom_description = {
			text = incompatible_tenet_anachoresis_trigger
			NOT = { tenet:tenet_anachoresis = { is_in_list = selected_doctrines } }
		}
	}

	traits = {
		sins = {
			devoted = { weight = 80 scale = 2 }
		}
	}
}

doctrine_sacraments_central = {
	doctrine_group_type = sacraments_group
	index = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					religion_tag = christianity_religion
					main_rite = { pam_latin_as_liturgical_language_trigger = yes }
				}
				desc = doctrine_sacraments_central_latin_desc
			}
			triggered_desc = {
				trigger = {
					religion_tag = christianity_religion
					main_rite = { pam_greek_as_liturgical_language_trigger = yes }
				}
				desc = doctrine_sacraments_central_greek_desc
			}
			desc = doctrine_sacraments_central_desc
		}
	}

	piety_cost = {
		if = {
			limit = {
				OR = {
					rite_religion_tag = christianity_religion
					rite_religion_tag = judaism_religion
				}
			}
			value = faith_tenet_cost_low
		}
		else_if = {
			limit = {
				rite_has_doctrine = pagan_hostility_doctrine
			}
			value = faith_tenet_cost_high
		}
		else = {
			value = faith_tenet_cost_mid
		}

		if = {
			limit = { rite_has_doctrine = doctrine_sacraments_central }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_sacraments_absent }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	traits = {
		virtues = {
			honest = { weight = 20 scale = 1 }
		}
		sins = {
			deceitful = { weight = 20 scale = 1 }
		}
	}

	parameters = {
		excommunication_active
		last_rites_active
		seek_indulgences_active
	}
}

doctrine_sacraments_absent = {
	doctrine_group_type = sacraments_group
	index = 1

	desc = doctrine_sacraments_absent_desc

	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { rite_has_doctrine = doctrine_sacraments_absent }
			multiply = faith_unchanged_doctrine_cost_mult
		}
		else_if = {
			limit = { rite_has_doctrine = doctrine_sacraments_central }
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
	}

	can_pick = {
		custom_description = {
			text = incompatible_tenet_communion_trigger
			NOT = { tenet:tenet_communion = { is_in_list = selected_doctrines } }
		}
	}
}
